package com.cms.manage.util;

import com.cms.manage.model.CmsUser;
import javax.servlet.http.HttpServletRequest;

public class UserUtil {
    public static final String USER = "cmsUser";


    public static CmsUser getUser(HttpServletRequest request) {
        Object terminalUser = request.getSession().getAttribute(USER);
        if (null == terminalUser) {
            return null;
        } else {
            return (CmsUser) terminalUser;
        }
    }

    public static Integer getUserId(HttpServletRequest request) {
    	CmsUser user = getUser(request);
        if (null == user) {
            return null;
        } else {
            return user.getId();
        }
    }

 
}
